var crypto = require('crypto');

module.exports = (req, resp, next) => {
    let token = req.headers['authorization'];
    if(!req.headers['isSaSec']) {
        next();
        return;
    }
    
    var originalRaw = req.body;
    var decipher = crypto.createDecipher('aes192', token);
    var dec = decipher.update(originalRaw, 'hex', 'utf8');
    dec += decipher.final('utf8');

    req.body = dec;
    next();
}